﻿#ifndef SCHEMEWINDOW_H
#define SCHEMEWINDOW_H

#include <QMainWindow>
#include <QTreeWidget>
#include <QDebug>
#include <map>
using namespace std;
#pragma execution_character_set("utf-8")

namespace Ui {
class SchemeWindow;
}

class SchemeWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit SchemeWindow(QWidget *parent = 0);
    ~SchemeWindow();

private:
    Ui::SchemeWindow *ui;
    map<QTreeWidgetItem*, Qt::CheckState> m_mapItemState;
    void InitTree();

    QTreeWidgetItem* AddTreeItem(QTreeWidget* pTree, QTreeWidgetItem* parentItem, QString itemTxt);//添加节点
    void GetCheckItem(QTreeWidget* pTree, QList<QString>& listTarget);//获取当前的所有checkbox状态，和选中的节点
    void ChangeChildItemState(QTreeWidgetItem* thisItem);//根据点击的节点，来改变节点的子节点状态
    void ChangeParentItemState(QTreeWidgetItem* thisItem);//根据点击的节点，来改变节点的父节点状态
    Qt::CheckState GetItemState(QTreeWidgetItem* item, map<QTreeWidgetItem*, Qt::CheckState>& mapItemState);//获取节点的上次状态

private slots:
    void TreeItemClicked(QTreeWidgetItem* item, int col);
};

#endif // SCHEMEWINDOW_H
